
#include <sys/types.h>
#include <sys/stat.h>

#include <librally.h>

#ifndef _RINDEXD
#define _RINDEXD

typedef struct {
	int cfgc;
	KeyValue *cfgv;
	char *logdir;
	Log_Level loglv;
	int num_thread_prestart_rstatd;
	int num_thread_prestart_client;
	struct sockaddr_in addr_rstatd;		// socket for rstatd daemons
	struct sockaddr_in addr_adm;			// socket for administration
	struct sockaddr_in addr_client;		// socket for client
} Config;

typedef struct {
	int fd_rstatd;
	int fd_adm;
	int fd_client;
	struct event ev_rstatd;
	struct event ev_adm;
	struct event ev_client;
	OpCode code;
	rp_thread_t tid_manager;		// it is the Main thread 
	Status *status_sched;
	rp_mutex_t mutex_sched;
	rp_sem_t sem_manager;
	Queue q_req;				// for external client requests 
	Queue q_adm;				// for administration commands
} Global;

typedef struct {
	char *bindir;
	char *cfgdir;
} Env;

Config config;
Global global;
Env env;

#endif	// _RINDEXD

